package com.edu.demo.quartz.trigger;

import org.quartz.CronScheduleBuilder;
import org.quartz.Trigger;
import org.quartz.TriggerBuilder;
import org.springframework.stereotype.Component;

@Component
public class DeleteRubbishTrigger {
    public static Trigger createTrigger(){
        Trigger trigger = TriggerBuilder.newTrigger()
                .withIdentity("headImg", "delete") //触发器的名称和分组
                //cron 每半个小时执行一次
                .withSchedule(CronScheduleBuilder.cronSchedule("0 0/30 * * * ?"))
                .startNow() //立即触发
                .build();
        return trigger;
    }
}
